package com.sky.chapter1.threadCreate;

/**
 * @author : wushikai
 * <p>
 * date : 2021-03-20
 */
public class MyRun  implements Runnable{


    /*内部怎么获取线程名字??*/
    @Override
    public void run() {
        System.out.println(  Thread.currentThread().getName() + " -- > 启动");
    }

    public static void main(String[] args){

        for (int i = 0; i < 5; i++) {

            Thread thread = new Thread(new MyRun());
            thread.setName("线程" + i);
            thread.start();
        }


    }
}
